/*
 * Created by SharpDevelop.
 * User: Oscar
 * Date: 15/06/2007
 * Time: 06:12 p.m.
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Web.UI;
using DemoPress.BlogServices;

namespace DemoPress.Web
{
	/// <summary>
	/// Description of DemoPage.
	/// </summary>
	public class DemoPage : Page
	{
		private const string CONTEXTKEY = "DemoPressBlogService";
        private BlogService _blogService;

        protected BlogService BlogService
        {
            get
            {
                if (_blogService == null)
                {
                    _blogService = (BlogService)HttpContext.Current.Items[CONTEXTKEY];
                }
                return _blogService;
            }
        }

		protected string AppParentPath
		{
			get
			{
				System.IO.DirectoryInfo dinfo = new System.IO.DirectoryInfo(ApplicationPath);
				return dinfo.Parent.FullName;
			}
		}

        protected string ApplicationPath
		{
			get
			{
				return this.MapPath("~");
			}
		}

        protected override void OnLoad(EventArgs e)
        {
            if (this.Header != null)
            {
                Page.Header.Title = this.BlogService.Theme.PageTitle;
            }
            base.OnLoad(e);
        }
	}
}
